package com.example.service;

import com.example.dao.DepartmentMapper;
import com.example.pojo.Department;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collection;

@Service
public class DepartmentServiceImpl implements DepartmentService {

    @Autowired
    private DepartmentMapper departmentMapper;

    //获取所有部门信息
    @Override
    public Collection<Department> getDepartments() {
        //return departmentMapper.getDepartments();
        return departmentMapper.selectList(null);
    }

    //通过id获取部门信息
    @Override
    public Department getDepartmentById(Integer id) {
        //return departmentMapper.getDepartmentById(id);
        return departmentMapper.selectById(id);
    }
}
